package com.woniuxy.controller;

import com.woniuxy.entity.*;
import com.woniuxy.service.QuestionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author wenlei
 * @ClassName QuestionController
 * @Description  题目
 * @date 2022/4/26 16:50
 **/
@Api(tags="题目管理")
@RestController
@RequestMapping("/question")
public class QuestionController {
    @Autowired
    QuestionService questionService;

    /**
     *@author wen
     *@Discription 增加一个单选题
     *@date 2022/4/26 17:29
     **/
    @ApiOperation("查询全部考生信息")
    @PostMapping("singleQiuestion")
    public ResponseEntity addSingleChoiceOne(@RequestBody Question question){
        return questionService.addSingleChoiceOne(question);
    }

    /**
     *@author wen
     *@Discription 增加一个多选题
     *@date 2022/4/26 17:29
     **/
    @PostMapping("multipleQiuestion")
    public ResponseEntity addMultipleChoiceOne(@RequestBody Question question){
        return questionService.addMultipleChoiceOne(question);
    }

    /**
     *@author wen
     *@Discription 增加一个判断题
     *@date 2022/4/26 17:29
     **/
    @PostMapping("addJudegOne")
    public ResponseEntity addJudegOne(@RequestBody Question question){
        return questionService.addJudegOne(question);
    }

    /**
     *@author wen
     *@Discription 增加一个问答题
     *@date 2022/4/26 17:29
     **/
    @PostMapping("addEssayQuestionOne")
    public ResponseEntity addEssayQuestionOne(@RequestBody Question question){
        return questionService.addEssayQuestionOne(question);
    }

    @ApiOperation("增加题目")
    @PostMapping("addQuestionOne")
    public ResponseEntity addQuestionOne(@RequestBody Question question){
        return questionService.addQuestionOne(question);
    }

    /**
     *@author wen
     *@Discription 增加一个填空题
     *@date 2022/4/26 17:29
     **/
    @PostMapping("addGapFillingOne")
    public ResponseEntity addGapFillingOne(@RequestBody Question question){
        return questionService.addGapFillingOne(question);
    }


    @ApiOperation("修改题目")
    @PutMapping("updateQuestion")
    public ResponseEntity updateQuestion(@RequestBody Question question){
        return questionService.updateQuestion(question);
    }

    @ApiOperation("根据题目id查询选择题答案")
    @GetMapping("findQuestion/{id}")
    public ResponseEntity findSelectAnswer(@PathVariable int id){
        return questionService.findSelectAnswer(id);
    }


}
